<?php
	if(isset($_GET['id'])&&(is_numeric($_GET['id']))){
		$id = $_GET['id'];
	    include './includes/connect.php';
		$sql = "SELECT * FROM articoli WHERE id='$id'";
		$query = @mysql_query($sql) or die (mysql_error());
		if(mysql_num_rows($query) > 0) {
			$row = mysql_fetch_array($query) or die (mysql_error());
			$id_articolo = $row['id'];
			$titolo = stripslashes($row['titolo']);
			$data = $row['data'];
			$articolo = stripslashes($row['articolo']);
			$art_id = $row['id'];
			$conta = "SELECT COUNT(com_id) as conta from commenti WHERE com_art = '{$art_id}'";
	        $conto = @mysql_query ($conta);
	        $tot = @mysql_fetch_array ($conto);

?>
			<div id="main">
				<div id="post">
					<div class="post-info" style="height: 60px;">
						<h1 class="post-title" style="margin-bottom: 10px;"><?=$row['titolo'];?></h1>
						Postato il <?=$data;?> | <a href="">Commenti (<?=$tot['conta'];?>)</a>
<?php
    		if(isset($_SESSION['utente'])){
?>
                		| <a href="./revise_post.php?id=<?=$row['id'];?>">Modifica</a>
<?php
    		}
?>
|
<?php
	    $sql2 = mysql_query("SELECT blog_url FROM info") or die(mysql_error()); 
	    $row2 = mysql_fetch_array($sql2);
	    $url = $row2['blog_url'];
?>
							<div class="addthis_toolbox addthis_default_style " style="display: inline-block; margin-bottom: -15px;">
								<a class="addthis_button_tweet" style="width: 85px;"></a>
								<a class="addthis_button_google_plusone" g:plusone:size="medium" style="width: 65px;"></a>
								<a class="addthis_button_facebook_like" fb:like:layout="button_count" style="width: 95px;"></a>
							</div>
							<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5158a6b41c43f8f8"></script>
					</div><!-- /post info -->
<?php
		}
?>
                <?=$row['articolo'];?>
            	</div><!-- /post -->
        	</div><!-- /main -->
<?php		          
	}
?>